
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
 
	<title>Google Feed Loader Example #1</title> 
	
	<script type="text/javascript" src="https://www.google.com/jsapi"></script> 
    <script type="text/javascript">
    google.load("feeds", "1");
    google.setOnLoadCallback(showFeed);
 
    function showFeed() {
      var feed = new google.feeds.Feed("http://blogs.sitepoint.com/feed/");
	  feed.setNumEntries(10);
      feed.load(function(result) {
        if (!result.error) {
		  var container = document.getElementById("headlines");
          for (var i = 0; i < result.feed.entries.length; i++) {
            var entry = result.feed.entries[i];
            var li = document.createElement("li");
            li.innerHTML = '<h3><a href="' + entry.link + '">' + entry.title + '</a> <cite>by ' + entry.author + '</cite></h3>';
            li.innerHTML += '<p>' + entry.contentSnippet + '</p>';
            container.appendChild(li);
          }
        } else {
			var container = document.getElementById("headlines");
		    container.innerHTML = '<li><a href="http://sitepoint.com">Get your geek news fix at SitePoint</a></li>';
		}
      });
    }
    </script>
	
</head> 
 
<body> 	
	<h1>Google Feed Loader Example</h1>
	<ul id="headlines"></ul> 
 
 
</body> 
</html>